/*
 * One example for NOI CSP-J Lesson 10:
 * <https://courses.fmsoft.cn/plzs/noijunior-csp-exercises-lower.html>
 *
 * Author: Vincent Wei
 *  - <https://github.com/VincentWei>
 *  - <https://gitee.com/vincentwei7>
 *
 * Copyright (C) 2025 FMSoft <https://www.fmsoft.cn>.
 * License: GPLv3
 */
#include <iostream>
#include <vector>
#include <cassert>

using namespace std;

int next_low_cost_stop(int n, vector<int>& a, int curr)
{
    int next = curr;
    while (next < n) {
        if (a[next] < a[curr]) {
            break;
        }

        next++;
    }

    return next;
}

int distance_between(vector<int>& v, int i, int j)
{
    int dist = 0;
    for (int k = i; k < j; k++) {
        dist += v[k];
    }

    return dist;
}

int min_cost(int n, int d, vector<int>& v, vector<int>& a)
{
    int dist_run = 0; // 目前车里的油能够行驶的距离。
    int cost = 0;

    for (int i = 0; i < n; i++) {

        // 目前车里的油不够行驶到下一站时，要加油。
        if (i < (n - 1) && (dist_run < v[i])) {
            // 确定在哪一站加油，以及到那个站点的距离。
            int next = next_low_cost_stop(n, a, i);
            int dist = distance_between(v, i, next);

            // 确定要加的油量。
            dist -= dist_run;
            int buy_gas = dist / d;
            if (dist % d)
                buy_gas++;

            // 计算成本，更新可以行驶的距离。
            cost += buy_gas * a[i];
            dist_run += buy_gas * d;
        }

        // 这站过了，更新可以行驶的距离。
        if (i < n - 1)
            dist_run -= v[i];
    }

    return cost;
}

int main()
{
    int n = 5, d = 4;
    vector<int> v = { 10, 10, 10, 10 };
    vector<int> a = { 9, 8, 9, 6, 5 };

    int ans;
    ans = min_cost(n, d, v, a);
    clog << ans << endl;
    assert(ans == 79);

    // 添加一个特殊情况测试用例：第一个站点的油价最低
    a = { 5, 8, 9, 6, 5 };
    ans = min_cost(n, d, v, a);
    clog << ans << endl;
    assert(ans == 50);

    cin >> n >> d;

    v.clear();
    for (int i = 0; i < n - 1; i++) {
        int tmp;
        cin >> tmp;
        v.push_back(tmp);
    }

    a.clear();
    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
    }

    ans = min_cost(n, d, v, a);
    cout << ans << endl;
    return 0;
}

